package modelo.persistir;

import java.util.ArrayList;

import modelo.mapa.Ubicacion;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

public class JugadorPersisitir {

	public static JsonObject persistir(ArrayList elems) 
	{
		Gson gson = new Gson();
		JsonObject jObject=new JsonObject();
		jObject.addProperty("Dinero",(int)elems.get(0));
		jObject.addProperty("Nombre",(String)elems.get(1));		
		return jObject;
	}

	public static ArrayList cargar(String comp)
	{
		ArrayList lista=new ArrayList();
		JsonParser parser = new JsonParser();
		JsonObject carg = parser.parse(comp).getAsJsonObject();		
		lista.add(carg.get("Dinero").getAsInt());
		lista.add(carg.get("Nombre").getAsString());		
		return lista;
	}
}